package test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

public class TcpClient {
	public static void main(String[] args) throws IOException {

		Socket client = new Socket("127.0.0.1", 5000);
		client.setSoTimeout(10000);

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		PrintStream out = new PrintStream(client.getOutputStream());

		BufferedReader buf =  new BufferedReader(new InputStreamReader(client.getInputStream()));

		out.println("你好");

		while(true) {
			String echo = buf.readLine();
			if (echo != null) {
				System.out.println(echo);
				return;
			}
		}
	}
}
